<!--
 * @Author: your name
 * @Date: 2022-01-18 14:13:43
 * @LastEditTime: 2022-01-18 14:13:43
 * @LastEditors: Please set LastEditors
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: \uniapp\index.html
-->
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0,maximum-scale=1,minimum-scale=1,user-scalable=no" />
    <title>index.html</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
    </style>
</head>

<body>
    <script>
        // const list = [1, 2, 3, 4];

        // let count = 10;
        // list.forEach((item) => {
        //   count += item;
        // });

        // console.log(count);

        const list = [1, 2, 3, 4];
        // const count=list.reduce(()=>{},初始值);
        // const count=list.reduce((已经累加和,循环元素)=>{
        const count = list.reduce((preCount, item) => {
            preCount += item;
            return preCount;
        }, 10);
        console.log(count);
    </script>
</body>

</html>